import React from 'react'
import Top from '../components/Top'
import Button from '../components/Button'
import { connect } from 'dva'

function HomePage(props) {
    const { home, dispatch, loading } = props
    console.log(home)
    // loading.models.home
    return (
        <div>
            HomePage  ---
            <button onClick={() => {
                dispatch({ type: "home/init" })
            }}>修改</button>
            <Top/>
            <Button/>
            {
                loading.models.home? "加载中": "加载完毕"
            }
        </div>
    )
}

const mapState = (state) => {
    const { home, loading } = state
    console.log(state)
    return {
        home,
        loading
    }
}

HomePage = connect(mapState)(HomePage)

export default HomePage
